; (function (window, undefined) {

function init(el) {
    let els = document.querySelectorAll(el)
    // 遍历数据，将js dom绑定到jq对象上
    for (let i = 0; i < els.length; i++) {
    this[i] = els[i]
    }

    this.length = els.length
}
// 正常：1000个 window*6 = 6000个字符
// 压缩：window形参改成一个字符
let jQuery = function (el) { 
    return new init(el)
}

jQuery.extend = function (object) {
    for (let key in object) { // key是方法名
    init.prototype[key] = object[key]
    }
}

init.prototype = {
    css(cssAttr, cssVal) {
    for (let i = 0; i < this.length; i++) {
        this[i].style[cssAttr] = cssVal 
    }
    return this
    },
    ajax(options) {},
    attr(options) {},
    addClass(options) {},
}

window.jQuery = window.$ = jQuery
})(window)